#include "..\include\socket.hpp"
#include <iostream>

using namespace std;

#define DEFAULT_PORT 27015

int main()
{
    try
    {
        WSA wsa;

        server_t server;

        server.bind(nullptr, DEFAULT_PORT, SOCK_TYPE::TCP);
        server.listen();
        server.accept();
        auto r = server.recv();
        cout << "Bytes received: " << r.size() << endl;
        int n = server.send(r);
        cout << "Bytes Sent: " << n << endl;
        server.shutdown(false, true);
        return 0;
    }
    catch (const char *s)
    {
        cerr << s << endl;
    }
    catch (std::string s)
    {
        cerr << s << endl;
    }
    return 1;
}